package com.winter.base;

import java.io.Serializable;

/**
 * @author JinHao
 * Date: 2023/07/25 14:27
 */
public class BusinessException extends RuntimeException implements Serializable {

    private String code;
    private String message;

    public BusinessException(String code, String message) {
        super(message);
        this.code = code;
        this.message = message;
    }

    public BusinessException(String message) {
        super(message);
        this.code = BusinessCode.FATAL.getCode();
        this.message = message;
    }

    public BusinessException(BusinessCode businessCode) {
        super(businessCode.getDesc());
        this.code = businessCode.getCode();
        this.message = businessCode.getDesc();
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
